
/*****************************************************************************
 *
 * 作   者: 叶友俊 * 创建时间: 2022/11/24 10:25:42 *
 * Copyright (C) 2008 - 鹏业软件公司
 *
 *****************************************************************************/

import {DataPacket, NorDataList} from 'pengesoft-ng-lib';

/**
 *
 */
export class Customer extends DataPacket {
  Id: string; // 客户id
  Name: string; // 姓名
  Sex: number; // 性别(1-男,2-女)
  Birthday: Date; // 出生日期
  NickName: string; // 用户名
  Phone: string; // 手机号码
  Email: string; // 邮箱
  Password: string; // 登录密码
  Address: string; // 现住地址
  State: number; // 状态(1-启用,2-注销)
  Avatar: string; // 头像存放地址
  IdCard: string; // 身份证号
  Authentication: number; // 是否实名认证(1-否,2-是)
  VipId: string; // 会员编号
  Credit: number; // 信用分
  Integral: number; // 积分
  CreateTime: Date; // 创建时间
  UpdateTime: Date; // 修改时间

  constructor(options: Partial<Customer> = {}) {
    super();
    this.Id = options.Id || '';
    this.Name = options.Name || '';
    this.Sex = !options.Sex ? 0 : Number.parseFloat(options.Sex.toString());
    this.Birthday = this.newDate(options.Birthday)!;
    this.NickName = options.NickName || '';
    this.Phone = options.Phone || '';
    this.Email = options.Email || '';
    this.Password = options.Password || '';
    this.Address = options.Address || '';
    this.State = !options.State ? 0 : Number.parseFloat(options.State.toString());
    this.Avatar = options.Avatar || '';
    this.IdCard = options.IdCard || '';
    this.Authentication = !options.Authentication ? 0 : Number.parseFloat(options.Authentication.toString());
    this.VipId = options.VipId || '';
    this.Credit = !options.Credit ? 0 : Number.parseFloat(options.Credit.toString());
    this.Integral = !options.Integral ? 0 : Number.parseFloat(options.Integral.toString());
    this.CreateTime = this.newDate(options.CreateTime)!;
    this.UpdateTime = this.newDate(options.UpdateTime)!;
  }
}

/**
 * 列表
 */
export class CustomerList extends NorDataList<Customer> {

  constructor(options: Partial<CustomerList> | Array<Customer> = {}) {
    super(options, Customer);
  }
}

